package org.finalministry.logger;

public class Duration {

   private long startTime = 0;

   private long stopTime = 0;

   private long durationTime = 0;

   private String message = "";

   // private Slf4JStopWatch stopWatch = null;

   public Duration(long startTime, String message) {

      this.startTime = startTime;
      this.message = message;
   }

   // public Duration(long start, String s, Slf4JStopWatch loggingStopWatch) {
   //
   // this.startTime = start;
   // this.message = s;
   // this.stopWatch = loggingStopWatch;
   // }

   public String getMessage() {

      return message;
   }

   public void setMessage(String message) {

      this.message = message;
   }

   public Duration() {

      super();
      this.start();
   }

   public long start() {

      startTime = System.currentTimeMillis();
      return startTime;
   }

   public long stop() {

      stopTime = System.currentTimeMillis();
      durationTime = stopTime - startTime;
      // if (this.stopWatch != null) {
      // stopWatch.stop();
      // }
      return stopTime;
   }

   public long getStartTime() {

      return startTime;
   }

   public void setStartTime(long startTime) {

      this.startTime = startTime;
   }

   public long getStopTime() {

      return stopTime;
   }

   public void setStopTime(long stopTime) {

      this.stopTime = stopTime;
   }

   public long getDurationTime() {

      return durationTime;
   }

   public void setDurationTime(long durationTime) {

      this.durationTime = durationTime;
   }

   public long measure() {

      long measureStopTime = System.currentTimeMillis();
      long measureDuration = measureStopTime - startTime;
      return measureDuration;
   }

}
